using System;
using Se.Framework.Common.Security;
using WebMatrix.WebData;

namespace Se.Framework.Web.Security
{
    public class WebSecurityUserManager : IUserManager
    {
        public bool Exists(string name)
        {
            return WebSecurity.UserExists(name);
        }

        public bool Create(string name, string password)
        {
            WebSecurity.CreateUserAndAccount(name, password);
            return true;
        }

        public bool Login(string userName, string password)
        {
            return WebSecurity.Login(userName, password);
        }

        public void LogoutUser()
        {
            WebSecurity.Logout();
        }

        public int GetuserId(string userName)
        {
            return WebSecurity.GetUserId(userName);
        }

        public bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            return WebSecurity.ChangePassword(userName, oldPassword, newPassword);
        }
    }
  
    
}